#include <stdio.h>
#include <string.h>

int main(int argc, char *argv[])
{
	char str[256];
	int arr[20], max, min, flg = 0;
	char *ps, *pe;

	gets(str);
	ps = pe = strtok(str, " ");
	for (pe = strtok(NULL, " "); pe; pe = strtok(NULL, " "), ps = pe) {
		if (flg == 0) {
			ps = pe;
			max = min = atoi(ps);
			flg = 1;
		}
		int t = atoi(ps);
		if (t < min) min = t;
		if (t > max) max = t;
	}
	printf("%d %d\n", max, min);

	return 0;
}
